﻿//
// Created by francklinson on 2021/3/21.
//

#ifndef CPPPRIMERPLUSREADINGCODES_SALES_H
#define CPPPRIMERPLUSREADINGCODES_SALES_H
#include <iostream>
#include <climits>
using namespace std;

class Sales
{
private:
    static const int QUARTERS = 4;
    double sales[QUARTERS]{};
    double average{};
    double max = 0;
    double min = INT_MAX;

public:
    // copies the lesser of 4 or n items from the array ar
    // to the sales member of s and computes and stores the
    // average, maximum, and minimum values of the entered items;
    // remaining elements of sales, if any, set to 0
    // 默认构造
    Sales();

    // 输入ar数组，根据前n位计算平均、最大、最小
    Sales(const double ar[], int n);

    // gathers sales for 4 quarters interactively, stores them
    // in the sales member of s and computes and stores the
    // average, maximum, and minimum values
    explicit Sales(int num);

    // display all information in structure s 列出Sales实例内容
    void showSales() const;
};

#endif //CPPPRIMERPLUSREADINGCODES_SALES_H
